# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=prosody-filer
pkgver=1.0.3
pkgrel=5
pkgdesc="Golang mod_http_upload_external server for Prosody and Ejabberd"
url="https://github.com/ThomasLeister/prosody-filer"
arch="all"
license="MIT"
makedepends="go"
options="chmod-clean net"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/ThomasLeister/prosody-filer/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build
}

check() {
	mv config.example.toml config.toml
	go test ./...
}

package() {
	install -Dm755 "$builddir"/$pkgname "$pkgdir"/usr/bin/$pkgname
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
6b030f91cd01b7a2c577f93394183bdbbef08c94f9c0111b12b715e5d024e0fea628e47073ac604af2835e6016e21f98cac99efb8cec6ad22d114130f76ea42f  prosody-filer-1.0.3.tar.gz
1460dd00df99fe8dc04f42c65731c6b002ac5a2c5dcd73af598f2a3c6d8befa5ff1d910b5417477a3c79efc5065e609621eab6919f93c3bef34169264939929f  prosody-filer.initd
d2ca3f7801bbf6252b3ee739aff79460ec76dbc0798ea8995d0f2b684d85347685ae3b7f2cc4cf186ad1c889fd79bc267f57f9c6c120f491afe943bf725e4abd  prosody-filer.confd
"
